<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
</html>

<script>
  const canvas = document.createElement("canvas");
  canvas.width = 600;
  canvas.height = 400;
  document.body.append(canvas);
  const context = canvas.getContext("2d");

  // 锥形渐变，第一个参数是弧度值，如果想要以角度来计算，需要转换,一开始是水平的
  const Conic = context.createConicGradient(90 * (Math.PI / 180), 100, 100);
  Conic.addColorStop(0, "red");
  Conic.addColorStop(0.5, "skyblue");
  Conic.addColorStop(1, "red");
  context.fillStyle = Conic;

  context.fillRect(0, 0, 200, 200);
</script>
